<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/16
  Time: 14:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>首页--汽车租赁系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css" media="all" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/dtree.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/font/dtreefont.css">
</head>
<body class="childrenBody">
<!-- 搜索条件开始 -->
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>查询条件</legend>
</fieldset>
<form class="layui-form" method="post" id="searchFrm">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">出租单号:</label>
            <div class="layui-input-inline" style="padding: 5px">
                <input type="text" name="rentid" id="rentid" autocomplete="off" class="layui-input layui-input-inline"
                       placeholder="请输入出租单号" style="height: 30px;border-radius: 10px">
            </div>
        </div>

        <div class="layui-inline" style="text-align: center">
            <button type="button"
                    class="layui-btn layui-btn-normal layui-icon layui-icon-search layui-btn-radius layui-btn-sm"
                    lay-submit  lay-filter="doSearch" style="margin-top: 4px">查询
            </button>
            <button type="reset"
                    class="layui-btn layui-btn-warm layui-icon layui-icon-refresh layui-btn-radius layui-btn-sm"
                    style="margin-top: 4px">重置
            </button>
        </div>
    </div>

</form>


<div id="content" style="">
    <blockquote class="layui-elem-quote" style="margin-top: 10px">
        <div id="test2">
            检查单表单
        </div>
    </blockquote>
    <form class="layui-form" method="post" id="checkFrm" lay-filter="checkFrm">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">检查单号:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="checkid" id="checkid" readonly="readonly"
                           class="layui-input layui-input-inline"
                           placeholder="请输入检查单号" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">出租单号:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="rentid" id="rentid2" readonly="readonly" autocomplete="off"
                           class="layui-input layui-input-inline"
                           placeholder="请输入出租单号" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">操作员:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="openname" id="openname" readonly="readonly" autocomplete="off"
                           class="layui-input layui-input-inline"
                           placeholder="请输入操作员" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
        </div>
        <input type="hidden" id="carnumber1" name="carnumber">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">存在问题:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="problem" id="problem" required  lay-verify="required" autocomplete="off"
                           class="layui-input layui-input-inline"
                           placeholder="请输入存在的问题" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">赔付金额:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="paymoney" id="paymoney" required  lay-verify="required" autocomplete="off"
                           class="layui-input layui-input-inline"
                           placeholder="请输入赔付金额" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">检查时间:</label>
                <div class="layui-input-inline" style="padding: 5px;width: 280px">
                    <input type="text" name="checkdate" id="checkdate" required  lay-verify="required"
                           class="layui-input layui-input-inline"
                           placeholder="请输入检查时间" style="height: 30px;border-radius: 10px;width: 280px">
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">问题描述:</label>
            <div class="layui-input-block">
                <textarea name="checkdesc" id="checkdesc" placeholder="请输入问题描述" required  lay-verify="required" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <button type="button" lay-submit lay-filter="doSubmit"
                    class="layui-btn layui-btn-normal layui-icon layui-icon-release layui-btn-radius layui-btn-sm"
                    lay-filter="doSubmit" lay-submit style="margin-top: 4px">保存
            </button>
        </div>
    </form>
    <%--出租单信息，车辆信息，客户信息的展示--%>
    <div style="padding: 10px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md4 layui-col-sm4">
                <div class="layui-card">
                    <div class="layui-card-header">车辆信息</div>
                    <div class="layui-card-body" id="car_carnumber"></div>
                    <div class="layui-card-body" id="car_cartype"></div>
                    <div class="layui-card-body" id="car_color"></div>
                    <div class="layui-card-body" id="car_price"></div>
                    <div class="layui-card-body" id="car_rentprice"></div>
                    <div class="layui-card-body" id="car_deposit"></div>
                    <div class="layui-card-body" id="car_description"></div>
                    <div class="layui-card-body">
                        车辆图片：<img src="" width="200" height="150" id="car_carimg">
                    </div>
                </div>
            </div>
            <div class="layui-col-md4 layui-col-sm4">
                <div class="layui-card">
                    <div class="layui-card-header">出租单信息</div>
                    <div class="layui-card-body" id="rent_rentid"></div>
                    <div class="layui-card-body" id="rent_price"></div>
                    <div class="layui-card-body" id="rent_begindate"></div>
                    <div class="layui-card-body" id="rent_returndate"></div>
                    <div class="layui-card-body" id="rent_openname"></div>
                </div>
            </div>
            <div class="layui-col-md4 layui-col-sm4">
                <div class="layui-card">
                    <div class="layui-card-header">客户信息</div>
                    <div class="layui-card-body" id="customer_identity"></div>
                    <div class="layui-card-body" id="customer_custname"></div>
                    <div class="layui-card-body" id="customer_sex"></div>
                    <div class="layui-card-body" id="customer_address"></div>
                    <div class="layui-card-body" id="customer_phone"></div>
                    <div class="layui-card-body" id="customer_career"></div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/index.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cache.js"></script>
<script>
    var tab;
    layui.use(
        ['table','jquery','layer','form'],function(){
            var table = layui.table;
            var form = layui.form;
            var $ = layui.jquery;
            var layer = layui.layer;

            form.on('submit(doSearch)',function(data1){
                $.post("${pageContext.request.contextPath}/carReturn/checkRentId",{"rentid":data1.field.rentid},function(r){
                  if(r.data.rentflag==1){
                      layer.msg("该车已归还")
                      return false;
                  }
                  $.post("${pageContext.request.contextPath}/carReturn/relativeCarInfoShow",{"rentid":data1.field.rentid},function(rr){
                      $("#car_carnumber").text(rr.data.carInfo.carnumber)
                      $("#car_carnumber1").text(rr.data.carInfo.carnumber)
                      $("#car_cartype").text(rr.data.carInfo.cartype)
                      $("#car_color").text(rr.data.carInfo.color)
                      $("#car_price").text(rr.data.carInfo.price)
                      $("#car_rentprice").text(rr.data.carInfo.rentprice)
                      $("#car_deposit").text(rr.data.carInfo.deposit)
                      $("#car_description").text(rr.data.carInfo.description)
                      $("#car_carimg").attr("src",rr.data.carInfo.carimg)
                      $("#rent_rentid").text(rr.data.rentInfo.rentid)
                      $("#rent_price").text(rr.data.rentInfo.price)
                      $("#rent_begindate").text(rr.data.rentInfo.begindate)
                      $("#rent_returndate").text(rr.data.rentInfo.returndate)
                      $("#rent_openname").text(rr.data.rentInfo.openname)
                      $("#customer_identity").text(rr.data.customer.identity)
                      $("#customer_custname").text(rr.data.customer.custname)
                      if(rr.data.customer.sex==0){
                          $("#customer_sex").text("女")
                      }else {
                          $("#customer_sex").text("男")
                      }
                      $("#customer_address").text(rr.data.customer.address)
                      $("#customer_phone").text(rr.data.customer.phone)
                      $("#customer_career").text(rr.data.customer.career)
                      $("#checkid").val(rr.data.returnNumber)
                      $("#rentid2").val(data1.field.rentid)
                      $("#openname").val(rr.data.user.realname)
                      $("#checkdate").val(rr.data.createtime)
                                        })
                })
            })
            form.on('submit(doSubmit)',function(data){
                var param = $("#checkFrm").serialize()
                layer.confirm("确定要提交该数据么", function (rr) {
                    $.get("${pageContext.request.contextPath}/carReturn/returnCar?" + param, function (rrr) {
                        layer.msg(rrr.msg)
                    })
                })
            })
        })
</script>

</body>
</html>
